
package com.example.maybeaccount.Entry;
import com.example.maybeaccount.Mode.Account;

import java.io.Serializable;
import java.util.ArrayList;
/**
 * 用户类，存放用户信息，包括用户名、密码等
 */
public class User implements Serializable {

    private int id;
    private String username;
    private String userpwd;
    private ArrayList<String> accountList = new ArrayList<String>();
    private String gridPwd;
    private int defaultUnlockMethod = 0;
    public static final int UNLOCK_METHOD_ALL = 0;
    public static final int UNLOCK_METHOD_TEXT = 1;
    public static final int UNLOCK_METHOD_GRID = 2;
    public static final int UNLOCK_METHOD_BIO = 3;


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUserpwd() {
        return userpwd;
    }

    public void setUserpwd(String userpwd) {
        this.userpwd = userpwd;
    }

    public boolean addAccout(String accountName){
        //添加账户名，添加成功则返回true，添加失败则返回false
        if(accountList.contains(accountName)){
            return false;
        }else{
            accountList.add(accountName);
            return true;
        }
    }
    public ArrayList<String> getAccountList(){
        return accountList;
    }
    public void deleteAccount(String accountName){
        accountList.remove(accountName);
    }

    public void setGridPwd(String gridPwd) {
        this.gridPwd = gridPwd;
    }

    public String getGridPwd() {
        return gridPwd;
    }

    public void setAccountList(ArrayList<String> accountList) {
        this.accountList = accountList;
    }

    public int getDefaultUnlockMethod() {
        return defaultUnlockMethod;
    }

    public void setDefaultUnlockMethod(int method){
        this.defaultUnlockMethod = method;
    }
}